package com.base.app;

import android.app.Application;
import android.content.Context;

import androidx.multidex.MultiDex;

import com.base.util.CrashHandler;
import com.im.event.EventBusInitializer;

public class BaseApp extends Application {
    private static BaseApp instance;

    public static BaseApp getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        initCrashError();
        initModules();
        EventBusInitializer.INSTANCE.init(this, null);
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    private void initCrashError() {
        CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(getApplicationContext());
    }

    protected void initModules() {
        //DataBaseHelper.init(this);
    }
}
